﻿using System;
using System.Reflection;

namespace NCommonLib.Extensions
{
    public static class CLRExtensions
    {
        public static object GetDefault(this Type type)
        {
            if (type.GetType().GetTypeInfo().IsValueType || type.Equals(typeof(string)))
            {
                return null;
            }
            else
            {
                return Activator.CreateInstance(type);
            }
        }
    }
}
